<script lang="ts" setup>
import {ref} from 'vue'
import {categoryGetList} from '@/api/category'

interface DepartmentItem {
  id: number;         // 确保与API返回的ID类型一致
  category: string; // 部门名称
  // 可根据实际API返回字段扩展
}
defineProps({
  modelValue:{
    type:[Number,String]
  }
})
const list  = ref<DepartmentItem[]>([])
const emit = defineEmits(['update:modelValue'])
const getList = async()=>{
  const res =  await categoryGetList()
  
  list.value = res.data.data
  
}
getList()
</script>

<template>
   
<el-select  :modelValue="modelValue" 
@update:modelValue="emit('update:modelValue',$event)">
    <el-option  v-for="select in list" :key="select.id" :label="select.category"  :value="select.category"> 
    </el-option>
</el-select>

</template>

<style lang="scss" scoped>
</style>